home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / MPW_C / GAWK / GAWK-2 / PROTOTYP.H < prev    next >
Text File  |  1990-09-29  |  11KB  |  778 lines

  1. /* 
  2.  * Copyright (C) 1986, 1988, 1989 the Free Software Foundation, Inc.
  3.  * 
  4.  * This file is part of GAWK, the GNU implementation of the
  5.  * AWK Progamming Language.
  6.  * 
  7.  * GAWK is free software; you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License as published by
  9.  * the Free Software Foundation; either version 1, or (at your option)
  10.  * any later version.
  11.  * 
  12.  * GAWK is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  * GNU General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU General Public License
  18.  * along with GAWK; see the file COPYING.  If not, write to
  19.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  */
  21.  
  22. #if defined (X3J11) || defined (THINK_C)
  23. typedef void    *pointer;        /* generic pointer type */
  24. #else
  25. typedef char    *pointer;        /* generic pointer type */
  26. #endif
  27.  
  28. /* Protoypes grabbed from file
  29. ** "alloca.c"
  30. ** 1990 Sep 5 (Wed) 20:40:48
  31. */
  32.  
  33. void         
  34. find_stack_direction(void);        
  35.  
  36. pointer         
  37. alloca(unsigned size);        /* # bytes to allocate */
  38.  
  39. /* Protoypes grabbed from file
  40. ** "awk.tab.c"
  41. ** 1990 Sep 6 (Thu) 20:38:04
  42. */
  43.  
  44. int         
  45. yyparse(void);        
  46.  
  47. void         
  48. yyerror(char *,...);    
  49.  
  50. int         
  51. yylex(void);        
  52.  
  53. FILE *        
  54. pathopen(char *file);        
  55.  
  56. NODE *        
  57. node_common(NODETYPE op);        
  58.  
  59. NODE *        
  60. node(NODE *left,         
  61.     NODETYPE op,         
  62.     NODE *right);        
  63.  
  64. NODE *        
  65. snode(NODE *subn,         
  66.     NODETYPE op,         
  67.     NODE *(*procp)());        
  68.  
  69. NODE *        
  70. mkrangenode(NODE *cpair);        
  71.  
  72. NODE *        
  73. make_for_loop(NODE *init,         
  74.     NODE *cond,         
  75.     NODE *incr);        
  76.  
  77. NODE *        
  78. install(NODE **table,         
  79.     char *name,         
  80.     NODE *value);        
  81.  
  82. NODE *        
  83. lookup(NODE **table,         
  84.     char *name);        
  85.  
  86. int         
  87. hashf(char *name,         
  88.     int len,         
  89.     int hashsize);        
  90.  
  91. NODE *        
  92. append_right(NODE *list,         
  93.     NODE *new);        
  94.  
  95. void         
  96. func_install(NODE *params,         
  97.     NODE *def);        
  98.  
  99. void         
  100. pop_var(NODE *np,         
  101.     int freeit);        
  102.  
  103. void         
  104. pop_params(NODE *params);        
  105.  
  106. NODE *        
  107. make_param(char *name);        
  108.  
  109. NODE *        
  110. variable(char *name);        
  111.  
  112. /* Protoypes grabbed from file
  113. ** "array.c"
  114. ** 1990 Aug 5 (Sun) 22:00:19
  115. */
  116.  
  117. NODE *        
  118. concat_exp(NODE *tree);        
  119.  
  120. void         
  121. assoc_clear(NODE *symbol);        
  122.  
  123. int         
  124. hash_calc(NODE *subs);        
  125.  
  126. NODE *        
  127. assoc_find(NODE *symbol,         
  128.     NODE *subs,         
  129.     int hash1);        
  130.  
  131. int         
  132. in_array(NODE *symbol,         
  133.     NODE *subs);        
  134.  
  135. NODE **        
  136. assoc_lookup(NODE *symbol,         
  137.     NODE *subs);        
  138.  
  139. void         
  140. do_delete(NODE *symbol,         
  141.     NODE *tree);        
  142.  
  143. struct search *        
  144. assoc_scan(NODE *symbol);        
  145.  
  146. struct search *        
  147. assoc_next(struct search *lookat);        
  148.  
  149. /* Protoypes grabbed from file
  150. ** "builtin.c"
  151. ** 1990 Jul 29 (Sun) 21:33:56
  152. */
  153.  
  154. NODE *        
  155. do_exp(NODE *tree);        
  156.  
  157. NODE *        
  158. do_index(NODE *tree);        
  159.  
  160. NODE *        
  161. do_int(NODE *tree);        
  162.  
  163. NODE *        
  164. do_length(NODE *tree);        
  165.  
  166. NODE *        
  167. do_log(NODE *tree);        
  168.  
  169. NODE *        
  170. do_sprintf(NODE *tree);        
  171.  
  172. void         
  173. do_printf(NODE *tree);        
  174.  
  175. NODE *        
  176. do_sqrt(NODE *tree);        
  177.  
  178. NODE *        
  179. do_substr(NODE *tree);        
  180.  
  181. NODE *        
  182. do_system(NODE *tree);        
  183.  
  184. void         
  185. do_print(NODE *tree);        
  186.  
  187. NODE *        
  188. do_tolower(NODE *tree);        
  189.  
  190. NODE *        
  191. do_toupper(NODE *tree);        
  192.  
  193. void         
  194. get_one(NODE *tree,         
  195.     NODE **res);        
  196.  
  197. void         
  198. get_two(NODE *tree,         
  199.     NODE **res1,         
  200.     NODE **res2);        
  201.  
  202. int         
  203. get_three(NODE *tree,         
  204.     NODE **res1,         
  205.     NODE **res2,         
  206.     NODE **res3);        
  207.  
  208. int         
  209. a_get_three(NODE *tree,         
  210.     NODE **res1,         
  211.     NODE **res2,         
  212.     NODE **res3);        
  213.  
  214. void         
  215. print_simple(NODE *tree,         
  216.     FILE *fp);        
  217.  
  218. NODE *        
  219. do_atan2(NODE *tree);        
  220.  
  221. NODE *        
  222. do_sin(NODE *tree);        
  223.  
  224. NODE *        
  225. do_cos(NODE *tree);        
  226.  
  227. NODE *        
  228. do_rand(NODE *tree);        
  229.  
  230. NODE *        
  231. do_srand(NODE *tree);        
  232.  
  233. NODE *        
  234. do_match(NODE *tree);        
  235.  
  236. NODE *        
  237. sub_common(NODE *tree,         
  238.     int global);        
  239.  
  240. NODE *        
  241. do_gsub(NODE *tree);        
  242.  
  243. NODE *        
  244. do_sub(NODE *tree);        
  245.  
  246. /* Protoypes grabbed from file
  247. ** "debug.c"
  248. ** 1990 Aug 18 (Sat) 13:22:48
  249. */
  250.  
  251.         
  252. ptree(NODE *n);        
  253.  
  254.         
  255. pt(void);        
  256.  
  257.         
  258. print_parse_tree(NODE *ptr);        
  259.  
  260.         
  261. dump_vars(void);        
  262.  
  263.         
  264. dump_fields(void);        
  265.  
  266.         
  267. print_debug(char *str,
  268.             int n);    
  269.         
  270. print_a_node(NODE *ptr);        
  271.  
  272.         
  273. print_maybe_semi(NODE *ptr);        
  274.  
  275.         
  276. deal_with_curls(NODE *ptr);        
  277.  
  278. NODE *        
  279. do_prvars(void);        
  280.  
  281. NODE *        
  282. do_bp(void);        
  283.  
  284. void         
  285. do_free(char *s);        
  286.  
  287. /* Protoypes grabbed from file
  288. ** "eval.c"
  289. ** 1990 Jul 29 (Sun) 21:33:54
  290. */
  291.  
  292. int         
  293. interpret(NODE *tree);        
  294.  
  295. NODE *        
  296. r_tree_eval(NODE *tree);        
  297.  
  298. void         
  299. assign_number(NODE **ptr,         
  300.     AWKNUM value);        
  301.  
  302. int         
  303. eval_condition(NODE *tree);        
  304.  
  305. int         
  306. cmp_nodes(NODE *t1,         
  307.     NODE *t2);        
  308.  
  309. NODE *        
  310. op_assign(NODE *tree);        
  311.  
  312. NODE *        
  313. func_call(NODE *name,         /* name is a Node_val giving function name */
  314.     NODE *arg_list);        /* Node_expression_list of calling args. */
  315.  
  316. NODE **        
  317. get_lhs(NODE *ptr,         
  318.     int assign);        /* this is being called for the LHS of an assign. */
  319.  
  320. NODE *        
  321. match_op(NODE *tree);        
  322.  
  323. /* Protoypes grabbed from file
  324. ** "field.c"
  325. ** 1990 Jul 29 (Sun) 21:34:01
  326. */
  327.  
  328. void         
  329. init_fields(void);        
  330.  
  331. void         
  332. set_field(int num,         
  333.     char *str,         
  334.     int len,         
  335.     NODE *dummy);        
  336.     
  337. void         
  338. rebuild_record(void);        
  339.  
  340. void         
  341. set_record(char *buf,         
  342.     int cnt);        
  343.  
  344. NODE **        
  345. get_field(int num,         
  346.     int assign);        
  347.     
  348. int         
  349. parse_fields(int up_to,         
  350.     char **buf,         
  351.     int len,         
  352.     char *fs,         
  353.     void (*set)(),         
  354.     NODE *n);        
  355.  
  356. int         
  357. re_split(char *buf,         
  358.     int len,         
  359.     char *fs,         
  360.     struct re_registers *reregsp);        
  361.  
  362. NODE *        
  363. do_split(NODE *tree);        
  364.  
  365. char *        
  366. get_fs(void);        
  367.  
  368. void         
  369. set_element(int num,         
  370.     char *s,         
  371.     int len,         
  372.     NODE *n);        
  373.  
  374. /* Protoypes grabbed from file
  375. ** "gnufuncts.c"
  376. ** 1990 Sep 5 (Wed) 20:49:10
  377. */
  378.  
  379. void         
  380. bzero(void *p,         
  381.     int n);        
  382.  
  383. FILE *        
  384. popen(char *s,         
  385.     char *mode);        
  386.  
  387.         
  388. pclose(FILE *fp);        
  389.  
  390. int         
  391. bcmp(char *d,         
  392.     char *d2,         
  393.     int mcnt);        
  394.  
  395. char *        
  396. index(char *s,         
  397.     char c);        
  398.  
  399. int         
  400. pipe(int fildes[2]);        
  401.  
  402. int         
  403. fork(void);        
  404.  
  405. int         
  406. wait(void *);        
  407.  
  408. int         
  409. dup2(int old,         
  410.     int new);        
  411.  
  412. pointer         
  413. xmalloc(unsigned int n);        
  414.  
  415. /* Protoypes grabbed from file
  416. ** "io.c"
  417. ** 1990 Aug 28 (Tue) 21:10:46
  418. */
  419.  
  420. IOBUF *        
  421. nextfile(void);        
  422.  
  423. IOBUF *        
  424. iop_alloc(int fd);        
  425.  
  426. void         
  427. do_input(void);        
  428.  
  429. int         
  430. iop_close(IOBUF *iop);        
  431.  
  432. int         
  433. inrec(IOBUF *iop);        
  434.  
  435. void         
  436. do_file(IOBUF *iop);        
  437.  
  438. int         
  439. get_rs(void);        
  440.  
  441. struct redirect *        
  442. redirect(NODE *tree,         
  443.     int *errflg);        
  444.  
  445. void         
  446. close_one(void);        
  447.  
  448. NODE *        
  449. do_close(NODE *tree);        
  450.  
  451. int         
  452. close_redir(struct redirect *rp);        
  453.  
  454. int         
  455. flush_io(void);        
  456.  
  457. int         
  458. close_io(void);        
  459.  
  460. int         
  461. devopen(char *name,         
  462.     char *mode);        
  463.  
  464. IOBUF *        
  465. gawk_popen(char *cmd,         
  466.     struct redirect *rp);        
  467.  
  468. int         
  469. gawk_pclose(struct redirect *rp);        
  470.  
  471. IOBUF *        
  472. gawk_popen(char *cmd,         
  473.     struct redirect *rp);        
  474.  
  475. int         
  476. gawk_pclose(struct redirect *rp);        
  477.  
  478. int         
  479. get_a_record(char **res,         
  480.     IOBUF *iop);        
  481.  
  482. NODE *        
  483. do_getline(NODE *tree);        
  484.  
  485. /* Protoypes grabbed from file
  486. ** "main.c"
  487. ** 1990 Sep 3 (Mon) 18:29:41
  488. */
  489.  
  490. int         
  491. main(int argc,         
  492.     char **argv);        
  493.  
  494. void         
  495. usage(void);        
  496.  
  497. struct re_pattern_buffer *        
  498. make_regexp(NODE *s,         
  499.     int ignorecase);        
  500.  
  501. struct re_pattern_buffer *        
  502. mk_re_parse(char *s,         
  503.     int ignorecase);        
  504.  
  505. void         
  506. copyleft(void);        
  507.  
  508. void         
  509. set_fs(char *str);        
  510.  
  511. void         
  512. init_args(int argc0,         
  513.     int argc,         
  514.     char *argv0,         
  515.     char **argv);        
  516.  
  517. void         
  518. init_vars(void);        
  519.  
  520. NODE *        
  521. spc_var(char *name,         
  522.     NODE *value);        
  523.  
  524. void         
  525. pre_assign(char *v);        
  526.  
  527. SIGTYPE         
  528. catchsig(int sig,         
  529.     int code);        
  530.  
  531. /* Protoypes grabbed from file
  532. ** "msg.c"
  533. ** 1990 Jul 29 (Sun) 21:33:58
  534. */
  535.  
  536. void         
  537. err(char *s, char *msg, va_list *argp);        
  538.  
  539. /* Protoypes grabbed from file
  540. ** "node.c"
  541. ** 1990 Jul 29 (Sun) 21:34:01
  542. */
  543.  
  544. AWKNUM         
  545. r_force_number(NODE *n);        
  546.  
  547. NODE *        
  548. r_force_string(NODE *s);        
  549.  
  550. NODE *        
  551. dupnode(NODE *n);        
  552.  
  553. NODE *        
  554. make_number(AWKNUM x);        
  555.  
  556. NODE *        
  557. tmp_number(AWKNUM x);        
  558.  
  559. NODE *        
  560. make_str_node(char *s,         
  561.     int len,         
  562.     int scan);        
  563.  
  564. NODE *        
  565. tmp_string(char *s,         
  566.     int len);        
  567.  
  568. NODE *        
  569. newnode(NODETYPE ty);        
  570.  
  571. void         
  572. freenode(NODE *it);        
  573.  
  574.         
  575. pf(void);        
  576.  
  577. void         
  578. do_deref(void);        
  579.  
  580. /* Protoypes grabbed from file
  581. ** "regex.c"
  582. ** 1990 Sep 2 (Sun) 21:54:54
  583. */
  584.  
  585. void         
  586. init_syntax_once(void);        
  587.  
  588. int         
  589. re_set_syntax(
  590.     int syntax);            
  591.  
  592. char *        
  593. re_compile_pattern(char *pattern,         
  594.     int size,         
  595.     struct re_pattern_buffer *bufp);        
  596.  
  597. int         
  598. store_jump(char *from,         
  599.     char opcode,         
  600.     char *to);        
  601.  
  602. int         
  603. insert_jump(char op,         
  604.     char *from,         
  605.     char *to,         
  606.     char *current_end);        
  607.  
  608. void         
  609. re_compile_fastmap(struct re_pattern_buffer *bufp);        
  610.  
  611. int         
  612. re_search(struct re_pattern_buffer *pbufp,         
  613.     char *string,         
  614.     int size,         
  615.     int startpos,         
  616.     int range,         
  617.     struct re_registers *regs);        
  618.  
  619. int         
  620. re_search_2(struct re_pattern_buffer *pbufp,         
  621.     char *string1,         
  622.     int size1,         
  623.     char *string2,         
  624.     int size2,         
  625.     int startpos,         
  626.     int range,         
  627.     struct re_registers *regs,         
  628.     int mstop);        
  629.  
  630. int         
  631. re_match(struct re_pattern_buffer *pbufp,         
  632.     char *string,         
  633.     int size,         
  634.     int pos,         
  635.     struct re_registers *regs);        
  636.  
  637. int         
  638. re_match_2(struct re_pattern_buffer *pbufp,         
  639.     unsigned char *string1,         
  640.     int size1,         
  641.     unsigned char *string2,         
  642.     int size2,         
  643.     int pos,         
  644.     struct re_registers *regs,         
  645.     int mstop);        
  646.  
  647. int         
  648. bcmp_translate(unsigned char *s1,         
  649.     unsigned char *s2,         
  650.     int len,         
  651.     unsigned char *translate);        
  652.  
  653. char *        
  654. re_comp(char *s);        
  655.  
  656. int         
  657. re_exec(char *s);        
  658.  
  659.         
  660. main(int argc,         
  661.     char **argv);        
  662.  
  663.         
  664. print_buf(struct re_pattern_buffer *bufp);        
  665.  
  666.         
  667. printchar(char c);        
  668.  
  669. /* Protoypes grabbed from file
  670. ** "gcvt.c"
  671. ** 1990 Jul 29 (Sun) 21:34:33
  672. */
  673.  
  674. char *        
  675. gcvt(double value,         
  676.     int digits,         
  677.     char *buff);        
  678.  
  679. /* Protoypes grabbed from file
  680. ** "getopt.c"
  681. ** 1990 Aug 18 (Sat) 13:19:18
  682. */
  683.  
  684. int         
  685. getopt(int argc,         
  686.     char **argv,         
  687.     char *opts);        
  688.  
  689.  
  690. /* Protoypes grabbed from file
  691. ** "random.c"
  692. ** 1990 Jul 29 (Sun) 21:34:35
  693. */
  694.  
  695.         
  696. srandom(unsigned x);        
  697.  
  698. char *        
  699. initstate(unsigned seed,         
  700.     char *arg_state,         
  701.     int n);        
  702.  
  703. char *        
  704. setstate(char *arg_state);        
  705.  
  706. long         
  707. random(void);        
  708.  
  709. /* Protoypes grabbed from file
  710. ** "strcase.c"
  711. ** 1990 Aug 18 (Sat) 13:21:27
  712. */
  713.  
  714.         
  715. strcasecmp(char *s1,         
  716.     char *s2);        
  717.  
  718.         
  719. strncasecmp(char *s1,         
  720.     char *s2,         
  721.     int n);        
  722.  
  723. /* Protoypes grabbed from file
  724. ** "strerror.c"
  725. ** 1990 Jul 29 (Sun) 21:34:36
  726. */
  727.  
  728. char *        
  729. strerror(int n);        
  730.  
  731. /* Protoypes grabbed from file
  732. ** "strtod.c"
  733. ** 1990 Jul 29 (Sun) 21:34:37
  734. */
  735.  
  736. double         
  737. strtod(char *s,         
  738.     char **ptr);        
  739.  
  740.         
  741. main(int argc,         
  742.     char **argv);        
  743.  
  744. /* Protoypes grabbed from file
  745. ** "tmpnam.c"
  746. ** 1990 Jul 29 (Sun) 21:34:37
  747. */
  748.  
  749. char *        
  750. tmpnam(char *tmp);        
  751.  
  752. /* Protoypes grabbed from file
  753. ** "vprintf.c"
  754. ** 1990 Jul 29 (Sun) 21:34:37
  755. */
  756.  
  757. int         
  758. vsprintf(char *str,         
  759.     char *fmt,         
  760.     va_list ap);        
  761.  
  762. int         
  763. vfprintf(FILE *iop,         
  764.     char *fmt,         
  765.     va_list ap);        
  766.  
  767. int         
  768. vprintf(char *fmt,         
  769.     va_list ap);        
  770.  
  771.  
  772. /* Protoypes grabbed from file
  773. ** "msg.c"
  774. ** 1990 Jul 29 (Sun) 21:33:58
  775. */
  776.  
  777. void 
  778. msg(char *,...);